package leecode

import "math"

func maxFrequencyElements(nums []int) int {
	count := math.MinInt
	hashMap := make(map[int]int)
	for _, num := range nums {
		hashMap[num]++
		count = max(count, hashMap[num])
	}
	var sum int
	for _, value := range hashMap {
		if value == count {
			sum += value
		}
	}
	return sum
}
